Add widget->allocation setter method
authorCody Russell <bratsche@gnome.org>
Thu, 13 Aug 2009 14:57:25 +0000 (09:57 -0500)
committerCody Russell <bratsche@gnome.org>
Thu, 13 Aug 2009 16:14:55 +0000 (11:14 -0500)
Add gtk_widget_set_allocation() to be used by size_allocate() methods,
since widget->allocation is now sealed.  Bug #585211

gtk/gtkwidget.c

index 267bd40fd00fbfc5f9b075163be3c02a3cc5613c..02810f09383029edb8e2d46d49dcc7158a5dad4d 100644 (file)
@@ -10768,6 +10768,26 @@ gtk_widget_get_allocation (GtkWidget     *widget,
   *allocation = widget->allocation;
 }
 
+/**
+ * gtk_widget_set_allocation:
+ * @widget: a #GtkWidget
+ * @allocation: a pointer to a #GtkAllocation to copy from
+ *
+ * Sets the widget's allocation.  This should not be used
+ * directly, but from within a widget's size_allocate method.
+ *
+ * Since: 2.18
+ */
+void
+gtk_widget_set_allocation (GtkWidget     *widget,
+                           GtkAllocation *allocation)
+{
+  g_return_if_fail (GTK_IS_WIDGET (widget));
+  g_return_if_fail (allocation != NULL);
+
+  widget->allocation = *allocation;
+}
+
 /**
  * gtk_widget_get_window:
  * @widget: a #GtkWidget